package cn.com.connected.common.listener;

import cn.com.connected.base.exception.ErrorLogRobot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;

/**
 * 作者:   邵明生
 * 时间:   2019/5/5 13:45
 * 描述:   项目启动成功
 */
public class StartSuccessListener implements ApplicationListener<ApplicationReadyEvent> {
    private static Logger logger = LoggerFactory.getLogger(StartSuccessListener.class);

    @Value("${server.name}")
    private String applicationName;

    @Value("${spring.profile.active}")
    private String profile;

    @Override
    public void onApplicationEvent(ApplicationReadyEvent ApplicationReadyEvent) {
        String messageBody  = " 启动成功";
        logger.info("异步发送启动日志");
        ErrorLogRobot.sendError2DingDing(messageBody);

    }
}